package com.zhuoyue.common.mqtt.util;

import java.util.UUID;

/**
 * @author wjming
 * @ClassName: WSMQTTServerCommon
 * @Description:
 * @Date 2021-07-08 16:27
 */
public final class WsMqttServerCommon {

    /**
     * 发布broker的ip和端口
     */
    public static final String TCP_ADDRESS = System.getProperty("TCPAddress", "tcp://192.168.2.88:1883");

    /**
     * 客户端id
     */
    public static String CLIENT_ID = String.format("%-23.23s", System.getProperty("clientId", (UUID.randomUUID().toString())).trim().replace("-", "_"));

    /**
     * 发布消息的主题
     */
    public static final String TOPIC_STRING = System.getProperty("topicString", "mqtt-test");

    /**
     * 发布的消息
     */
    public static final String PUBLICATION = System.getProperty("publication", "Hello Mosquitto" + String.format("%tc", System.currentTimeMillis()));

    /**
     * 超时时间
     */
    public static final int QUIESCE_TIMEOUT = Integer.parseInt(System.getProperty("timeout", "10000"));

    public static final int SLEEP_TIMEOUT = Integer.parseInt(System.getProperty("timeout", "10000"));

    public static boolean CLEAN_SESSION = Boolean.parseBoolean(System.getProperty("cleanSession", "false"));

    public static final int QOS = Integer.parseInt(System.getProperty("Qos", "1"));

    public static final boolean RETAINED = Boolean.parseBoolean(System.getProperty("retained", "false"));

}
